package com.mms.controller;


import com.alibaba.fastjson.JSONObject;
import com.mms.service.IMedicalOfficeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 陈林鹏
 * @since 2021-04-14
 */
@Controller
@RequestMapping("/medicalOffice")
public class MedicalOfficeController {

    /**
     * 科室服务类
     */
    @Autowired
    IMedicalOfficeService medicalOfficeService;

    /**
     * 获取科室 所有Id 和姓名
     *
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "getAllIdName")
    public String getAllIdName() {
        //创建一个 json 返回 对象
        JSONObject retJson = new JSONObject();
        //获取科室表 所有的 Id 和 office_name
        List<Map<String, Object>> allIdName = medicalOfficeService.getAllIdName();
        //打包返回数据
        retJson.put("code", 0);
        retJson.put("data", allIdName);
        retJson.put("msg", "获取成功");
        return retJson.toString();
    }

}

